<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
 <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.7">
 <TITLE>SDCC Compiler User Guide: Absolute addressing.</TITLE>
 <LINK HREF="SDCCUdoc-11.html" REL=next>
 <LINK HREF="SDCCUdoc-9.html" REL=previous>
 <LINK HREF="SDCCUdoc.html#toc10" REL=contents>
</HEAD>
<BODY>
<A HREF="SDCCUdoc-11.html">Next</A>
<A HREF="SDCCUdoc-9.html">Previous</A>
<A HREF="SDCCUdoc.html#toc10">Contents</A>
<HR>
<H2><A NAME="Absolute Addressing"></A> <A NAME="s10">10. Absolute addressing.</A> </H2>

<P>Data items can be assigned an absolute address with the at &lt;address&gt;
keyword, in addition to a storage class.
<P>
<PRE>
eg. xdata at 0x8000 unsigned char PORTA_8255 ;
 
</PRE>
<P>In the above example the PORTA_8255 will be allocated to the location 0x8000
of the external ram. 
<P>Note that is this feature is provided to give the programmer access to
memory mapped devices attached to the controller. The compiler does not actually
reserve any space for variables declared in this way (they are implemented
with an equate in the assembler), thus it is left to the programmer to make
sure there are no overlaps with other variables that are declared without the
absolute address, the assembler listing file (.lst) and the linker output files
(&lt;filename&gt;.rst) and (&lt;filename&gt;.map) are a good places to look
for such overlaps.
<P>Absolute address can be specified for variables in all storage classes.
<P>
<PRE>
eg.bit at 0x02 bvar;
 
</PRE>
<P>The above example will allocate the variable at offset 0x02 in the bit-addressable
space. There is no real advantage to assigning absolute addresses to variables
in this manner , unless you want strict control over all the variables allocated.
<HR>
<A HREF="SDCCUdoc-11.html">Next</A>
<A HREF="SDCCUdoc-9.html">Previous</A>
<A HREF="SDCCUdoc.html#toc10">Contents</A>
</BODY>
</HTML>
